from appium import webdriver


class Base:
    #初始化
    def __init__(self):
        cap={
          "platformName": "Android",
          "appium:deviceName": "emulator-5554",
          "appium:automationName": "uiautomator2",
          "appium:appPackage": "com.xiachufang",
          "appium:appActivity": ".activity.home.HomeActivity",
          "appium:noReset": True
        }
        #连接软件
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
        #隐式等待
        self.driver.implicitly_wait(10);
        #元素定位方法
    def find_ele(self,ele):
        loc=self.driver.find_element(*ele)
        return loc
    #测试固件,清理数据
    def find_tui(self):
        self.driver.quit()
    #截图方法
    def find_jie(self,filename):
        self.driver.save_screenshot(filename)
    #轻敲方法
    def find_qng(self,a,b):
        self.driver.tap([(a,b)],200)